<template>
  <view>
    <view class="search-container" :style="{'background-color': bgcolor}">
      <view class="searech-box" :style="{'border-radius': radius + 'px'}" @click="searchBoxHandler">
        <uni-icons type="search" size="17"></uni-icons>
        <text class="search-text">搜索</text>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    props: {
      bgcolor: {
        type: String,
        default: '#c00000'
      },
      radius: {
        type: Number,
        default: '15' //px
      }
    },
    name:"my-search",
    data() {
      return {
        
      };
    },
    methods: {
      searchBoxHandler(){
        // 连接父组件的按钮事件
        this.$emit('click')
      }
    }
  }
</script>

<style lang="scss">
.search-container{
  // background-color: #c00000;
  height: 50px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  
  .searech-box{
    height: 36px;
    background-color: #FFFFFF;
    // border-radius: 15px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    
    .search-text {
      font-size: 15px;
      margin-left: 5px;
    }
  }
}
</style>